<?php
/**
  * 留言模型
  */
class CommentModel extends CommonModel
{
   	// 验证设置
   	protected $_validate	 =	 array(
		array('content','require','内容必填！',self::MODEL_BOTH)
		);

   	protected $_auto=array(
		array('add_time','time',self::MODEL_BOTH,'function'),
		array('username','callbackReplyName',self::MODEL_BOTH,'callback'),
		array('email','callbackEmail',self::MODEL_BOTH,'callback'),
		array('status',1),
		array('ip_address','callbackIpAddress',self::MODEL_INSERT,'callback')
		);

	protected function callbackReplyName()
	{
		return $_SESSION['truename'];
	}  

	protected function callbackEmail()
	{
		return $_SESSION['email'];
	}

	protected function callbackIpAddress()
	{
	  return get_client_ip();
	}	

}
?>